package com.yanfan.ccapi.controller;

import com.yanfan.ccapi.service.ICcapiThirdPartyActionService;
import com.yanfan.ccapicode.dao.entity.ThirdPartyActionDO;
import com.yanfan.common.annotation.Log;
import com.yanfan.common.core.controller.BaseController;
import com.yanfan.common.core.domain.AjaxResult;
import com.yanfan.common.core.page.TableDataInfo;
import com.yanfan.common.enums.BusinessType;
import com.yanfan.common.utils.poi.ExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 语音平台动作标识Controller
 *
 * @author kerwincui
 * @date 2025-06-29
 */
@RestController
@RequestMapping("/ccapi/thirdPartyAction")
@Api(tags = "语音平台动作标识")
public class CcapiThirdPartyActionController extends BaseController {
    @Autowired
    private ICcapiThirdPartyActionService ccapiThirdPartyActionService;

    /**
     * 查询语音平台动作标识列表
     */
//@PreAuthorize("@ss.hasPermi('ccapi:thirdPartyAction:list')")
    @GetMapping("/list")
    @ApiOperation("查询语音平台动作标识列表")
    public TableDataInfo list(ThirdPartyActionDO ccapiThirdPartyAction) {
        startPage();
        List<ThirdPartyActionDO> list = ccapiThirdPartyActionService.selectCcapiThirdPartyActionList(ccapiThirdPartyAction);
        return getDataTable(list);
    }

    /**
     * 导出语音平台动作标识列表
     */
    @ApiOperation("导出语音平台动作标识列表")
    //@PreAuthorize("@ss.hasPermi('ccapi:thirdPartyAction:export')")
    @Log(title = "语音平台动作标识", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ThirdPartyActionDO ccapiThirdPartyAction) {
        List<ThirdPartyActionDO> list = ccapiThirdPartyActionService.selectCcapiThirdPartyActionList(ccapiThirdPartyAction);
        ExcelUtil<ThirdPartyActionDO> util = new ExcelUtil<ThirdPartyActionDO>(ThirdPartyActionDO.class);
        util.exportExcel(response, list, "语音平台动作标识数据");
    }

    /**
     * 获取语音平台动作标识详细信息
     */
    //@PreAuthorize("@ss.hasPermi('ccapi:thirdPartyAction:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取语音平台动作标识详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(ccapiThirdPartyActionService.selectCcapiThirdPartyActionById(id));
    }

    /**
     * 新增语音平台动作标识
     */
    //@PreAuthorize("@ss.hasPermi('ccapi:thirdPartyAction:add')")
    @Log(title = "语音平台动作标识", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增语音平台动作标识")
    public AjaxResult add(@RequestBody ThirdPartyActionDO ccapiThirdPartyAction) {
        return toAjax(ccapiThirdPartyActionService.insertCcapiThirdPartyAction(ccapiThirdPartyAction));
    }

    /**
     * 修改语音平台动作标识
     */
    //@PreAuthorize("@ss.hasPermi('ccapi:thirdPartyAction:edit')")
    @Log(title = "语音平台动作标识", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改语音平台动作标识")
    public AjaxResult edit(@RequestBody ThirdPartyActionDO ccapiThirdPartyAction) {
        return toAjax(ccapiThirdPartyActionService.updateCcapiThirdPartyAction(ccapiThirdPartyAction));
    }

    /**
     * 删除语音平台动作标识
     */
    //@PreAuthorize("@ss.hasPermi('ccapi:thirdPartyAction:remove')")
    @Log(title = "语音平台动作标识", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    @ApiOperation("删除语音平台动作标识")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(ccapiThirdPartyActionService.deleteCcapiThirdPartyActionByIds(ids));
    }
}
